home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xa / Welcome.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  8.2 KB  |  160 lines

  1. package com.extensibility.xa;
  2.  
  3. import com.extensibility.app.BaseApplication;
  4. import com.extensibility.app.BaseDocument;
  5. import com.extensibility.app.Desktop;
  6. import com.extensibility.app.HelpWindow;
  7. import com.extensibility.app.UI;
  8. import com.extensibility.convert.BaseImportAction;
  9. import com.extensibility.rock.RAction;
  10. import com.extensibility.rock.Screen;
  11. import com.extensibility.xml.URI;
  12. import java.awt.BorderLayout;
  13. import java.awt.Color;
  14. import java.awt.Component;
  15. import java.awt.Cursor;
  16. import java.awt.Font;
  17. import java.awt.Frame;
  18. import java.awt.LayoutManager;
  19. import java.awt.Rectangle;
  20. import java.awt.Window;
  21. import java.awt.event.ActionEvent;
  22. import java.util.EventObject;
  23. import javax.swing.JCheckBox;
  24. import javax.swing.JFrame;
  25. import javax.swing.JLabel;
  26. import javax.swing.KeyStroke;
  27.  
  28. public class Welcome extends JFrame {
  29.    JLabel art;
  30.    JCheckBox cbShow;
  31.    Hiliter[] btns = new Hiliter[16];
  32.    boolean clickLock = false;
  33.    static final int INDEX_OPEN = 0;
  34.    static final int INDEX_NEW = 1;
  35.    static final int INDEX_IMPORT_EXAMPLE = 2;
  36.    static final int INDEX_IMPORT_SUBSET = 3;
  37.    static final int INDEX_IMPORT_SGML = 4;
  38.    static final int INDEX_IMPORT_TEXT = 5;
  39.    static final int INDEX_IMPORT_ODBC = 6;
  40.    static final int INDEX_IMPORT_JAVA = 7;
  41.    static final int INDEX_IMPORT_COM = 8;
  42.    static final int INDEX_IMPORT_LDAP = 9;
  43.    static final int INDEX_HELP_TOUR = 10;
  44.    static final int INDEX_HELP_STARTED = 11;
  45.    static final int INDEX_HELP_RESULT = 12;
  46.    static final int INDEX_HELP_HOWS = 13;
  47.    static final int INDEX_HELP_HOOD = 14;
  48.    static final int INDEX_HELP_FAQ = 15;
  49.    static Rectangle[] areas = new Rectangle[]{new Rectangle(14, 19, 105, 104), new Rectangle(133, 19, 105, 104), new Rectangle(25, 201, 98, 20), new Rectangle(25, 223, 98, 20), new Rectangle(25, 245, 98, 20), new Rectangle(25, 267, 98, 20), new Rectangle(127, 201, 98, 20), new Rectangle(127, 223, 98, 20), new Rectangle(127, 245, 98, 20), new Rectangle(127, 267, 98, 20), new Rectangle(269, 91, 190, 19), new Rectangle(269, 117, 190, 19), new Rectangle(269, 143, 190, 19), new Rectangle(269, 183, 190, 19), new Rectangle(269, 210, 190, 19), new Rectangle(269, 238, 190, 19)};
  50.    RAction newAction = new 8(this);
  51.    RAction openAction = new 9(this);
  52.    RAction closeAction = new 10((Welcome)null);
  53.  
  54.    public Welcome() {
  55.       this.prepare();
  56.    }
  57.  
  58.    private SchemaDoc makeNewAndHide(EventObject var1) {
  59.       ((Component)this).setVisible(false);
  60.       SchemaDoc var2 = (SchemaDoc)BaseApplication.getApplication().newDocument(var1);
  61.       return var2;
  62.    }
  63.  
  64.    private void doImport(ActionEvent var1, BaseImportAction var2) {
  65.       SchemaDoc var3 = var2.getDoc();
  66.       Frame var4 = Desktop.getDialogParent(var1);
  67.       this.clickLock = true;
  68.       if (var2.doImport(var4)) {
  69.          ((Authority)BaseApplication.getApplication()).newDocument(var3, false);
  70.          ((BaseDocument)var3).setTouched(true);
  71.          ((Component)this).setVisible(false);
  72.       } else {
  73.          ((Component)this).setVisible(true);
  74.       }
  75.  
  76.       this.clickLock = false;
  77.    }
  78.  
  79.    void goHelp(ActionEvent var1, String var2) {
  80.       ((Component)this).setCursor(Cursor.getPredefinedCursor(3));
  81.       HelpWindow var3 = Desktop.createHelpWindow(UI.getString(String.valueOf(var2).concat(String.valueOf(".htm"))));
  82.       ((Component)this).setCursor(Cursor.getDefaultCursor());
  83.    }
  84.  
  85.    public String getClassName() {
  86.       return "com.extensibility.xa.Welcome";
  87.    }
  88.  
  89.    protected RAction createRecentAction(String var1) {
  90.       URI var2 = new URI((URI)null, var1);
  91.       return new 1(var2, this, var2.getShortName());
  92.    }
  93.  
  94.    protected RAction createNewFlavorAction(String var1) {
  95.       return new 2(var1, this, UI.getFileTypeName(var1));
  96.    }
  97.  
  98.    protected RAction createNewAction() {
  99.       return new 3(this, UI.getString("new.item.default", UI.getFileTypeName(SchemaDoc.getDefaultSchemaFlavor())), 'N');
  100.    }
  101.  
  102.    protected void addPopups() {
  103.       this.btns[1].addMouseListener(new 4(this));
  104.       this.btns[0].addMouseListener(new 5(this));
  105.    }
  106.  
  107.    protected void prepare() {
  108.       this.art = new JLabel(UI.getIcon("welcome.gif"));
  109.       this.cbShow = new JCheckBox(UI.getString("welcome.show"));
  110.       ((JFrame)this).setDefaultCloseOperation(1);
  111.       ((Frame)this).setTitle(UI.getString(this.getClassName()));
  112.       ((Frame)this).setIconImage(UI.getImage("ity.gif"));
  113.       this.cbShow.setSelected(BaseApplication.getPreferences().getShowWelcome());
  114.       this.cbShow.addActionListener(new 6(this));
  115.       this.cbShow.setFont(new Font("Dialog", 0, 9));
  116.       ((JFrame)this).getContentPane().setLayout(new BorderLayout());
  117.       ((JFrame)this).getContentPane().add(this.art, "Center");
  118.       ((Window)this).pack();
  119.       ((JFrame)this).getContentPane().setLayout((LayoutManager)null);
  120.       Screen.centerInScreen(this);
  121.       ((JFrame)this).getContentPane().remove(this.art);
  122.  
  123.       for(int var1 = 0; var1 < areas.length; ++var1) {
  124.          this.btns[var1] = new Hiliter(this, var1);
  125.          ((JFrame)this).getContentPane().add(this.btns[var1]);
  126.          this.btns[var1].setBounds(areas[var1].getBounds());
  127.       }
  128.  
  129.       this.addPopups();
  130.       ((JFrame)this).getContentPane().add(this.cbShow);
  131.       this.cbShow.setLocation(278, 271);
  132.       this.cbShow.setBackground(Color.white);
  133.       this.cbShow.setSize(this.cbShow.getPreferredSize());
  134.       ((JFrame)this).getContentPane().add(this.art);
  135.       ((Window)this).addWindowListener(new 7((Welcome)null));
  136.    }
  137.  
  138.    public void addNotify() {
  139.       super.addNotify();
  140.       ((JFrame)this).getRootPane().registerKeyboardAction(this.newAction, "", KeyStroke.getKeyStroke(78, 0), 2);
  141.       ((JFrame)this).getRootPane().registerKeyboardAction(this.openAction, "", KeyStroke.getKeyStroke(79, 0), 2);
  142.       ((JFrame)this).getRootPane().registerKeyboardAction(this.closeAction, "", KeyStroke.getKeyStroke(27, 0), 2);
  143.    }
  144.  
  145.    public void show() {
  146.       this.cbShow.setSelected(BaseApplication.getPreferences().getShowWelcome());
  147.       super.show();
  148.    }
  149.  
  150.    // $FF: synthetic method
  151.    static void access$6000171(Welcome var0, ActionEvent var1, BaseImportAction var2) {
  152.       var0.doImport(var1, var2);
  153.    }
  154.  
  155.    // $FF: synthetic method
  156.    static SchemaDoc access$6000071(Welcome var0, EventObject var1) {
  157.       return var0.makeNewAndHide(var1);
  158.    }
  159. }
  160.